package de.ret_world.openrpgstudio.mediamanager;

import buoy.widget.BSplitPane;
import de.ret_world.openrpgstudio.editor.Configuration;
import de.ret_world.openrpgstudio.editor.Media;
import javax.swing.filechooser.FileFilter;
import org.java.plugin.Plugin;
import org.java.plugin.PluginManager;
import org.java.plugin.registry.PluginDescriptor;

/**
 * Default Interface for MediaTab Plugins. Defines methods to call several aspects of plugins.
 *
 * @author Emu
 */
public abstract class MediaTabPlugin extends Plugin {

    protected static Configuration config;
    protected static PluginManager manager;
    protected static PluginDescriptor descriptor;

    /**
     * Initializes the plugin.
     */
    public abstract void init(BSplitPane container);

    /**
     * This is called when the user presses the OK button of the DatabaseDialog.
     */
    public abstract void save();

    @Override
    protected void doStart() throws Exception {
        config = Configuration.getInstance(getDescriptor().getId());
        descriptor = getDescriptor();
        manager = getManager();
    }

    @Override
    protected void doStop() throws Exception {
    }
    
    /**
     * @return the FieFilter for this media file type
     */
    public abstract FileFilter getFileFilter();
    
    /**
     * @return the int value to represent this media type
     */
    public abstract int getMediaTypeNr();
    
    /**
     * Adds a new Media Object to this plugins components.
     */
    public abstract void addMedia(Media m);
    
    /**
     * @return Gets the in this plugins components selected media.
     */
    public abstract Media getMedia();
}
